<template>
  <div class="h100">
    <div class="cases-top" @click="gohome()">
      <img src="~@/assets/reception/logo.png" />
    </div>
    <div class="cases-bac">
      <img src="~@/assets/reception/cases/detail.png" alt="" >
    </div>
    <div class="cases-main">
      <div class="cases-detail">
        <div class="a-df" style="margin: 0 auto;">
          <div class="cases-title-left"></div>
          <span class="cases-title">
            <span>项目案例</span>
            <span class="cases-title-eng">Project Cases</span>
          </span>
          <div class="cases-title-right"></div>
        </div>
      </div>
      <div :class="{
          card: true,
          flipped: flipped,
        }">
        <div class="cases-items front">
          <div v-for="item in casesList" :key="item.ID" class="cases-item"  @click="routerpush(item.ID)">
            <!-- <img src="~@/assets/reception/test.png" /> -->
            <img :src=" upload + item.Imgs" />
            <!-- <span class="cases-item-title">东莞市公安局</span> -->
            <span class="cases-item-title">{{ item.NAME }}</span>
            <!-- <span class="cases-item-content">{{ displayContent('东莞市公安局无线对讲机通讯通信解决覆盖设计方案无线对讲方案，采用摩托罗拉的MOTOTRBO数字IP互联集群中转系统，配合双功器、天线和低损耗馈线组成的') }}</span> -->
            <span class="cases-item-content">{{ displayContent(item.MS) }}</span>
          </div>
        </div>
        <div class="back">
          <span class="rollback" @click="rollback()"><a-icon type="rollback" /></span>
          <casesDetailItem :casesItemID = casesItemID></casesDetailItem>
        </div>
      </div>
    </div>
    <div class="cases-bac-bottom">
      <img src="~@/assets/reception/background2.png" alt="" >
    </div>
  </div>
</template>

<script>
import casesDetailItem from './casesDetailItem.vue';
import { getAppGetXMALListApi } from '@/api/resService'

export default {
  name: 'receptionHome',
  components: {
    casesDetailItem,
    // RichText
  },
  data () {
    return {
      flipped:false,
      casesList:[],
      casesItemID:'',
      upload:process.env.VUE_APP_API_BASE_URL,
    }
  },
  methods: {
    displayContent(text) {
      if ( text <= 100) {
        return text;
      }
      return text.substring(0, 100) + '...';
    },
    getAppGetXMALList(){
      getAppGetXMALListApi(
        {
          pageSize:10,
          pageIndex:1,
          RMTJ:1,
        }
      ).then((res) => {
        console.log('res',res);
        this.casesList = res.data
      })
      .catch((err) => {
      })
      .finally(() => {
      })
    },
    routerpush(id){
      this.casesItemID = id
      console.log('this.casesItemID',this.casesItemID);
      this.flipped = !this.flipped
      // this.$router.push({ path: '/reception/cases/detail/item' });
    },
    gohome() {
      this.$router.push({ path: '/reception/Introduction/index' });
    },
    rollback(){
      this.flipped = !this.flipped
    }
    // flipCard(index){
    //   this.flipped = !this.flipped
    // }
  },
  mounted() {
    this.getAppGetXMALList()
  },
}
</script>

<style lang="less" scoped >
.cases-top{
  height: 60px;
  background: #fff;
  padding: 10px 100px ;
  cursor: pointer;
  img{
    height: 40px;
    display: block;
  }
}
.cases-bac{
  img{
    height: 330px;
    width: 100%;
  }
}
.cases-main{
  margin-top:30px ;
  .functional-module{
    width: 130px;
    margin-top:10px ;
    display: flex;
    flex-direction:column;
    position: absolute;
    left: 10px;
    img{
      margin: 5px 0;
      // height: 95px;
      cursor: pointer;
    }
  }
  .cases-detail{
    margin: 0 auto;
    width: 1600px;
    display: flex;
    .cases-title-left{
      width: 30px;
      height: 40px;
      border: #e7e7e7 solid 3px;
      border-right: none;
    }
    .cases-title-right{
      width: 30px;
      height: 40px;
      border: #e7e7e7 solid 3px;
      border-left: none;
    }
    .cases-title{
      color: #444444;
      font-size:24px ;
      display: block;
      line-height: 30px;
      margin: 0 10px;
      display: flex;
      flex-direction: column;
      .cases-title-eng{
        font-size: 14px;
        margin-top:-10px ;
        color: #a9a9a9;
      }
      // margin: 0 auto;
      // border-bottom: 2px solid #1e50ae;
    }
    
  }
  .cases-items{
      display: flex;
      flex-wrap: wrap;
      .cases-item{
        width: 30%;
        height: 300px;
        margin: 20px auto;
        overflow: hidden;
        border: #e7e7e7 1px solid;
        border-radius:10px ;
        cursor: pointer;
        .cases-item-title{
          font-size: 20px;
          display: block;
          margin: 10px 15px;
        }
        .cases-item-content{
          display: block;
          margin: 10px 15px;
        }
        img{
          width: 100%;
          height: 200px;
        }
      }
    }
}
.cases-bac-bottom{
  position: absolute;
  bottom: -400px;
  width: 100%;
  img{
    height: 180px;
    width: 100%;
  }
}

.card {
    flex: 1;
    height: 200px;
    margin-left: 50px;
    position: relative;
    // background-color: #fff;
    // border: solid 1px #efebec;
    border-radius: 25px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.6s;
}

.flipped .front {
    transform: rotateY(180deg);
}

.flipped .back {
    transform: rotateY(0deg);
}

.front,
.back {
  // margin: 0 auto;
  width: 1600px;
  left: 50%;
  margin-left: -820px;
  position: absolute;
  backface-visibility: hidden;
  border-radius: 10px;
}

.front {
    justify-content: center;
    align-items: center;
    transform: rotateY(0deg);
    transition: transform 0.6s;
}

.back {
    display: flex;
    height: 660px;
    border: solid 2px #e7e7e7;
    transform: rotateY(-180deg);
    transition: transform 0.6s;
    overflow: hidden;
    .rollback{
      position: absolute;
      left: 20px;
      top: 20px;
      .anticon-rollback{
        font-size:24px ;
      }
    }
}
</style>